import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import Index from '@/components/Index'
import Details from '@/components/Details'
import Examine from '@/components/Examine'
import login from '@/components/login'
import Staff from '@/components/Staff'

Vue.use(Router)

export default new Router({
  // mode:'history',
  routes: [
    {
      path:"/",
      name:'login',
      component:login
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      meta: {
        requireAuth: true, // 判断是否需要登录
       },
      children:[
        {
          path:'/Index',
          // name:'Index',
          component:Index
        },
        {
          path:'/Staff',
          // name:'Index',
          component:Staff
        },
        {
          path:'/Details',
          name:'Details',
          component:Details
        },
        {
          path:'/Examine',
          name:'Examine',
          component:Examine
        }
      ]
    },
   
   
  ]
})
// router.beforeEach((to, from, next) => {
//   let isLogin = !!localStorage.eleToken
//   if (to.path === '/login' || to.path === '/register') {
//     next()
//   } else {
//     isLogin ? next() : next('/login')
//   }
// })

